<?php

namespace app\base\model;


use think\Model;
use think\Request;
class Configs extends Model
{
    protected $resultSetType = 'collection';

    protected function initialize(){
        //需要调用model的intitalize方法
        parent::initialize();
        //TODO:自定义的初始化
    }


    public function getBigLogoAttr($value){
        if(empty($value)){
            return $value;
        }
        return Request::instance()->domain().$value;
    }

    /**
     * @param $id
     * @return mixed  获取单一id的config
     */
    public function get_config_id($id){
                return self::get($id)->getData();
    }

    public function getConfigByKey($key){
                return self::where("key",$key)->find()->getData();
    }


    public function get_config_groupid($id)
    {
       // return self::getByGroup_config_id($id)->getData();
        $res= self::where(["group_config_id"=>$id])->field("id,key,value,logo,is_position,big_logo")->select()->toArray();

        return $res;

    }

}